package com.hopedove.callsystem.activity.call

import android.content.Intent
import android.os.Bundle
import android.view.View
import com.hopedove.base.BaseActivity
import com.hopedove.callsystem.R
import com.hopedove.callsystem.databinding.ActivityCallMainBinding

/**
 * 业务选择类
 */
class CallMainActivity : BaseActivity(), View.OnClickListener {

    lateinit var binding: ActivityCallMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityCallMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        initViews()
    }

    private fun initViews() {
        findViewById<View>(R.id.createcall).setOnClickListener(this)
        findViewById<View>(R.id.confirmcall).setOnClickListener(this)
        findViewById<View>(R.id.saveCall).setOnClickListener(this)
        findViewById<View>(R.id.saveStart).setOnClickListener(this)
        findViewById<View>(R.id.saveFinish).setOnClickListener(this)
        findViewById<View>(R.id.backTrayCall).setOnClickListener(this)
        binding.backBtn.setOnClickListener {
            finish()
        }
    }


    override fun onClick(v: View) {
        val id = v.id
        when (id) {
            R.id.createcall -> {
                // 新建呼叫
                val intent = Intent(this, ScanBarcodeActivity::class.java)
                startActivity(intent)
            }

            R.id.confirmcall -> {
                // 确认呼叫
                val intentConfirm = Intent(this, ConfirmCallActivity::class.java)
                startActivity(intentConfirm)
            }
            R.id.saveCall -> {
                // 机台呼叫保全
                val intentSaveCall = Intent(this, SaveCallActivity::class.java)
                startActivity(intentSaveCall)
            }

            R.id.saveStart -> SaveStartActivity.actionStart(this, "", "", "", "", "")
            // 保全完成
            R.id.saveFinish -> {
                val intentSaveFinish = Intent(this, SaveFinishActivity::class.java)
                startActivity(intentSaveFinish)
            }
            R.id.backTrayCall -> {
                val intentbackTray = Intent(this, BackTrayCallActivity::class.java)
                startActivity(intentbackTray)
            }
            else -> {
            }
        }
    }

}